<?php

/*	LibFox - Simple library for XML-based backends.
	Copyright (C) 2008 LinFox Serviços em Informática LTDA.

	This file is part of LibFox.

	LibFox is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	LibFox is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program.  If not, see <http://www.gnu.org/licenses/>. */

class db {
	private static $instance;

	private function __construct() { }

	public static function get_instance() {
		if (empty(self::$instance)) {
			self::$instance = new PDO('mysql:host='.setup::db_hostname.';dbname='.setup::db_database, setup::db_username, setup::db_password);
			self::$instance->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
		}
		return self::$instance;
	}
}

?>